Skip to content

Extensible memory file layers — registry-driven, decoupled, layer-aware#820

Merged
chubes4 merged 1 commit intomainfrom
feature/extensible-memory-file-layers
Mar 16, 2026
Merged

Extensible memory file layers — registry-driven, decoupled, layer-aware#820
chubes4 merged 1 commit intomainfrom
feature/extensible-memory-file-layers

Conversation

@chubes4
Copy link
Member

@chubes4 chubes4 commented Mar 16, 2026

Summary

Memory files now follow the same registration pattern as handlers and step types: rich metadata, WordPress hooks, and a single registry as the source of truth.

  • All three layers (shared, agent, user) are extensible — plugins can register files in any layer
  • Core files register through the same API that third parties use — no special-casing
  • Every file specifies its layer, protection status, label, and description
  • datamachine_memory_files action hook provides the third-party extension point

Before → After

Before: Hardcoded file lists in CoreMemoryFilesDirective, FileConstants,
        AgentFileList.jsx, and MemoryFilesSelector.jsx. Custom files
        only loaded from agent directory.

After:  Single MemoryFileRegistry with layer-aware metadata. Everything
        driven by the registry. Files resolved to correct layer directory
        at runtime.

Architecture

┌──────────────────────────────────────────────────────────────────┐
│                    MemoryFileRegistry                            │
│  register('SITE.md',   10, {layer:'shared', protected:true})    │
│  register('SOUL.md',   20, {layer:'agent',  protected:true})    │
│  register('USER.md',   25, {layer:'user',   protected:true})    │
│  register('MEMORY.md', 30, {layer:'agent',  protected:true})    │
│  register('my-ctx.md', 60, {layer:'agent'})  ← plugin           │
│                                                                  │
│  Extension hook: do_action('datamachine_memory_files')           │
├──────────────┬───────────────────┬───────────────────────────────┤
│ Consumers:   │                   │                               │
│              ▼                   ▼                               ▼
│  CoreMemoryFilesDirective   MemoryFilesReader    AgentFileAbilities
│  (Priority 20 injection)    (Pipeline/Flow)      (CRUD + layer routing)
│                              Now layer-aware      Now layer-aware
└──────────────────────────────────────────────────────────────────┘

Files changed (10)

File What changed
MemoryFileRegistry.php Added layer, protected, label, description metadata + datamachine_memory_files action hook
bootstrap.php All 5 core files now register with full metadata
CoreMemoryFilesDirective.php Driven entirely by registry — no hardcoded file list
MemoryFilesReader.php Resolves layer from registry (fixes: shared/user files now work in pipeline/flow selection)
AgentFileAbilities.php Write/upload support layer parameter; delete uses registry protection
FileConstants.php Delegates to registry; legacy constants kept for backward compat
AgentFiles.php (REST) Uses FileConstants::is_protected() instead of in_array()
AgentFileList.jsx Uses file.protected from API instead of hardcoded array
MemoryFilesSelector.jsx Uses registered + protected flags from API instead of hardcoded EXCLUDED_FILES
wordpress-as-agent-memory.md Updated extension docs with layer-aware registration examples

Key behavior changes

  1. Pipeline/flow memory file selection now works across all layers — previously only loaded from agent directory, silently missing shared/user files
  2. All 5 core files are now protected from deletion (previously only SOUL.md and MEMORY.md were)
  3. Write operations accept a layer parameter — registered files route to their registered layer; new files can target any layer
  4. Frontend uses API metadata instead of hardcoded file lists for protection and exclusion checks

Testing

  • PHP syntax: all 7 modified PHP files pass php -l
  • PHPUnit: 873 passed, 26 failed (all pre-existing, none related to this PR)
  • No existing tests for these components

Memory files now follow the same registration pattern as handlers and
step types: rich metadata, WordPress filter hooks, and a single registry
as the source of truth.

MemoryFileRegistry:
- Each file specifies layer (shared/agent/user), protection status,
  label, and description
- datamachine_memory_files action hook for third-party extensibility
- All core files (SITE.md, RULES.md, SOUL.md, MEMORY.md, USER.md)
  register through the same API plugins use

CoreMemoryFilesDirective:
- Driven entirely by the registry — no hardcoded file lists
- Resolves each file to its layer directory at runtime

MemoryFilesReader:
- Pipeline/flow memory file injection now resolves layer from registry
- Fixes: files selected from shared/user layers in the picker now work
  at execution time (previously only checked agent directory)

AgentFileAbilities:
- Write and upload support explicit layer parameter
- Layer resolution: explicit param > registry layer > agent (default)
- Delete uses registry-driven protection instead of hardcoded constant
- List response includes protected, registered, label, description

FileConstants:
- Delegates to MemoryFileRegistry for protection and layer checks
- Legacy constants kept for backward compatibility

Frontend:
- AgentFileList uses file.protected from API instead of hardcoded array
- MemoryFilesSelector uses registered+protected flags from API instead
  of hardcoded EXCLUDED_FILES list
@github-actions
Copy link

github-actions bot commented Mar 16, 2026

Homeboy Results — data-machine

Lint

⚡ Scope: changed files only

lint (changed files only)

Test

Failure Digest

Test Failure Digest

Autofixability classification

  • Overall: human_needed
  • Autofix enabled: no
  • Autofix attempted this run: no
  • Human-needed failed commands:
    • test
  • Failed commands with available automated fixes:
    • test
  • Automated fixes are disabled for this step. Commands with available fix support in this run: test

Machine-readable artifacts

  • homeboy-lint-summary.json
  • homeboy-test-failures.json
  • homeboy-audit-summary.json
  • homeboy-autofixability.json

⚡ Scope: changed files only

test (changed files only)

Audit

⚡ Scope: changed files only

audit (changed files only)

Tooling versions
  • Homeboy CLI: homeboy 0.78.0+9b06ea92
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: unknown
  • Action: Extra-Chill/homeboy-action@v1

Homeboy Action v1

@chubes4 chubes4 merged commit bc6673b into main Mar 16, 2026
2 of 3 checks passed
@chubes4 chubes4 deleted the feature/extensible-memory-file-layers branch March 16, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant